package com.baimawangzi.recovery.servlet.courier;

import com.baimawangzi.recovery.bean.Courier;
import com.baimawangzi.recovery.service.impl.CourierServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/courierfindbyid.do")
public class CourierFindById extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        CourierServiceImpl courierService = new CourierServiceImpl();
        //解析url参数
        int id = Integer.parseInt(req.getParameter("id"));
        Courier courier = courierService.findById(id);
        System.out.println(courier+"111111111111111111");
        req.setAttribute("courier",courier);
        req.getRequestDispatcher("courier_update.jsp").forward(req,resp);

    }
}
